package com.example.test.servicelmpl;

import com.example.test.bean.UserBean;
import com.example.test.bean.UserImgBean;
import com.example.test.mapper.UserMapper;
import com.example.test.service.UserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServicelmpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public UserBean loginln(String name,String password){
        return userMapper.getinfo(name,password);
    }
    @Override
    public List<UserBean>getAllUser(){
        return userMapper.getAllUser();
    }
    @Override
    public int insertUser(UserBean userBean){
        return userMapper.insertUser(userBean);
    }
    @Override
    public int deleteUser(String id){
        return  userMapper.deleteUser(id);
    }
    @Override
    public UserBean getUserById(String id){
        return userMapper.getUserById(id);
    }
    @Override
    public int updateUser(UserBean userBean){
        return userMapper.updateUser(userBean);
    }
    @Override
    public PageInfo<UserBean> selectUser4Page(Integer page,Integer pageSize){
        PageHelper.startPage(page,pageSize);
        List<UserBean> users = userMapper.selectUser4Page();
        return new PageInfo<>(users);
    }
    @Override
    public int insertUserImg(UserImgBean userImgBean){
        return userMapper.insertUserImg(userImgBean);
    }

    @Override
    public int getId(UserBean userBean) {
        return userMapper.getId(userBean);
    }
    @Override
    public List<UserImgBean>getUserImgsById(String user_id){
        return userMapper.getUserImgsById(user_id);
    }
}

